#include "sigslottest.h"
#include <QDebug>
#include <QTimer>

SigSlotTest::SigSlotTest(QObject *parent)
    : QObject(parent)
{

}

void SigSlotTest::setNext(SigSlotTest *obj)
{
    m_next = obj;
    connect(this, &SigSlotTest::sig, m_next, &SigSlotTest::onSig);
}

void SigSlotTest::onSig(int s)
{
    qDebug() << sender()->objectName() << " -> " << objectName() << s;

//    QTimer::singleShot(10, this, [=](){
//        emit sig(s);
//    });
    int cnt = 1000000;
    while (cnt--);
    emit sig(s);
}
